/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package genericmetamodel.impl;

import genericmetamodel.Assets;
import genericmetamodel.Feature;
import genericmetamodel.GenericmetamodelPackage;
import genericmetamodel.Mapping;
import genericmetamodel.SPL_Model;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>SPL Model</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link genericmetamodel.impl.SPL_ModelImpl#getLine_Name <em>Line Name</em>}</li>
 *   <li>{@link genericmetamodel.impl.SPL_ModelImpl#getFeatureRef <em>Feature Ref</em>}</li>
 *   <li>{@link genericmetamodel.impl.SPL_ModelImpl#getMappingRef <em>Mapping Ref</em>}</li>
 *   <li>{@link genericmetamodel.impl.SPL_ModelImpl#getAssetRef <em>Asset Ref</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SPL_ModelImpl extends EObjectImpl implements SPL_Model {
	/**
	 * The default value of the '{@link #getLine_Name() <em>Line Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLine_Name()
	 * @generated
	 * @ordered
	 */
	protected static final String LINE_NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getLine_Name() <em>Line Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLine_Name()
	 * @generated
	 * @ordered
	 */
	protected String line_Name = LINE_NAME_EDEFAULT;

	/**
	 * The cached value of the '{@link #getFeatureRef() <em>Feature Ref</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFeatureRef()
	 * @generated
	 * @ordered
	 */
	protected EList<Feature> featureRef;

	/**
	 * The cached value of the '{@link #getMappingRef() <em>Mapping Ref</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMappingRef()
	 * @generated
	 * @ordered
	 */
	protected EList<Mapping> mappingRef;

	/**
	 * The cached value of the '{@link #getAssetRef() <em>Asset Ref</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAssetRef()
	 * @generated
	 * @ordered
	 */
	protected EList<Assets> assetRef;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SPL_ModelImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return GenericmetamodelPackage.Literals.SPL_MODEL;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getLine_Name() {
		return line_Name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLine_Name(String newLine_Name) {
		String oldLine_Name = line_Name;
		line_Name = newLine_Name;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GenericmetamodelPackage.SPL_MODEL__LINE_NAME, oldLine_Name, line_Name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Feature> getFeatureRef() {
		if (featureRef == null) {
			featureRef = new EObjectContainmentEList<Feature>(Feature.class, this, GenericmetamodelPackage.SPL_MODEL__FEATURE_REF);
		}
		return featureRef;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Mapping> getMappingRef() {
		if (mappingRef == null) {
			mappingRef = new EObjectContainmentEList<Mapping>(Mapping.class, this, GenericmetamodelPackage.SPL_MODEL__MAPPING_REF);
		}
		return mappingRef;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Assets> getAssetRef() {
		if (assetRef == null) {
			assetRef = new EObjectContainmentEList<Assets>(Assets.class, this, GenericmetamodelPackage.SPL_MODEL__ASSET_REF);
		}
		return assetRef;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case GenericmetamodelPackage.SPL_MODEL__FEATURE_REF:
				return ((InternalEList<?>)getFeatureRef()).basicRemove(otherEnd, msgs);
			case GenericmetamodelPackage.SPL_MODEL__MAPPING_REF:
				return ((InternalEList<?>)getMappingRef()).basicRemove(otherEnd, msgs);
			case GenericmetamodelPackage.SPL_MODEL__ASSET_REF:
				return ((InternalEList<?>)getAssetRef()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case GenericmetamodelPackage.SPL_MODEL__LINE_NAME:
				return getLine_Name();
			case GenericmetamodelPackage.SPL_MODEL__FEATURE_REF:
				return getFeatureRef();
			case GenericmetamodelPackage.SPL_MODEL__MAPPING_REF:
				return getMappingRef();
			case GenericmetamodelPackage.SPL_MODEL__ASSET_REF:
				return getAssetRef();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case GenericmetamodelPackage.SPL_MODEL__LINE_NAME:
				setLine_Name((String)newValue);
				return;
			case GenericmetamodelPackage.SPL_MODEL__FEATURE_REF:
				getFeatureRef().clear();
				getFeatureRef().addAll((Collection<? extends Feature>)newValue);
				return;
			case GenericmetamodelPackage.SPL_MODEL__MAPPING_REF:
				getMappingRef().clear();
				getMappingRef().addAll((Collection<? extends Mapping>)newValue);
				return;
			case GenericmetamodelPackage.SPL_MODEL__ASSET_REF:
				getAssetRef().clear();
				getAssetRef().addAll((Collection<? extends Assets>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case GenericmetamodelPackage.SPL_MODEL__LINE_NAME:
				setLine_Name(LINE_NAME_EDEFAULT);
				return;
			case GenericmetamodelPackage.SPL_MODEL__FEATURE_REF:
				getFeatureRef().clear();
				return;
			case GenericmetamodelPackage.SPL_MODEL__MAPPING_REF:
				getMappingRef().clear();
				return;
			case GenericmetamodelPackage.SPL_MODEL__ASSET_REF:
				getAssetRef().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case GenericmetamodelPackage.SPL_MODEL__LINE_NAME:
				return LINE_NAME_EDEFAULT == null ? line_Name != null : !LINE_NAME_EDEFAULT.equals(line_Name);
			case GenericmetamodelPackage.SPL_MODEL__FEATURE_REF:
				return featureRef != null && !featureRef.isEmpty();
			case GenericmetamodelPackage.SPL_MODEL__MAPPING_REF:
				return mappingRef != null && !mappingRef.isEmpty();
			case GenericmetamodelPackage.SPL_MODEL__ASSET_REF:
				return assetRef != null && !assetRef.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (Line_Name: ");
		result.append(line_Name);
		result.append(')');
		return result.toString();
	}

} //SPL_ModelImpl
